import { createReducer } from '../utils/index';
import { SHOW_ACCOUNT_STATUS, SHOW_ACCOUNT_PIC, EDIT_ACCOUNT_STATUS, CHANGE_PASS_STATUS ,SHOW_PIC_AFTER } from '../contants/user'

const initialState = {
    showed: null,
    picshowed: null,
    edited: null,
    changed: null,
    picchanged: null,
    accountData: {},
    accountPic:''
};

export default createReducer(initialState, {
    [SHOW_ACCOUNT_STATUS]: (state, payload) => {
        return Object.assign({}, state, {
            showed: payload.status,
            accountData: payload.data
        })
    },
    [SHOW_ACCOUNT_PIC]: (state, payload) => {
        return Object.assign({}, state, {
            picshowed: payload.status,
            accountPic: 'http://'+payload.data
        })
    }
});